//#include <stdio.h>
#include "treenode.h"
extern FILE *yyin;
extern int yylineno;
extern treenode* root;
extern int unhandle;
bool err = 0;
int main(int argc, char **argv)
{
    if (argc <= 1)
        return 1;
    FILE *f = fopen(argv[1], "r");
    if (!f)
    {
        perror(argv[1]);
        return 1;
    }
    yyrestart(f);
    yylineno = 1;
    yyparse();
    if (unhandle > 0)
    {
        fprintf(stderr,"Syntax error.\n");
    }
    if (!err)
        printTree(0, root);
    return 0;
}
/*int main(int argc, char** argv) {
if (argc > 1) {
if (!(yyin = fopen(argv[1], "r"))) {
perror(argv[1]);
return 1;
}
}
while (yylex() != 0);
return 0;
}
*/